import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询旅行社列表
export function listTravelagen(query) {
  return request({
    url: '/lxy/travelagen/list',
    method: 'get',
    params: query
  })
}

// 查询旅行社详细
export function getTravelagen(id) {
  return request({
    url: '/lxy/travelagen/' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增旅行社
export function addTravelagen(data) {
  return request({
    url: '/lxy/travelagen',
    method: 'post',
    data: data
  })
}

// 修改旅行社
export function updateTravelagen(data) {
  return request({
    url: '/lxy/travelagen',
    method: 'put',
    data: data
  })
}

// 旅行社状态修改
export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/lxy/travelagen/changeStatus',
    method: 'put',
    data: data
  })
}

// 旅行社密码重置
export function resetAgencyPwd(id, password) {
  const data = {
    id,
    password
  }
  return request({
    url: '/lxy/travelagen/resetPwd',
    method: 'put',
    data: data
  })
}

// 查询授权项目
export function getAuthProject(id) {
  return request({
    url: '/lxy/travelagen/authProject/' + id,
    method: 'get'
  })
}

// 保存授权项目
export function updateAuthProject(data) {
  return request({
    url: '/lxy/travelagen/authProject',
    method: 'put',
    params: data
  })
}

// 删除旅行社
export function delTravelagen(id) {
  return request({
    url: '/lxy/travelagen/' + id,
    method: 'delete'
  })
}

// 停用旅行社
export function stopTravelagen(id) {
  return request({
    url: '/lxy/travelagen/' + id,
    method: 'put'
  })
}